#if 0
#include <buola/image/algorithm.h>
#include <buola/image/cimageplugin.h>

#include <X11/xpm.h>
#include <buola/gui/x11/cx11display.h>

namespace buola { namespace gui { namespace x11 {

class CXPMCodec : public CImageCodec 
{
public:
    CXPMCodec();
    virtual ~CXPMCodec();

    using CImageCodec::ReadImage;
    using CImageCodec::WriteImage;

    virtual void ReadImage(img::CImage_gray8 &pData,io::PBufferStream pStream,
                        const CSize_i &pSize);
    virtual void WriteImage(const img::CView_gray8 &pView,io::PBufferStream pStream);
    virtual void ReadImage(img::CImage_rgb8 &pData,io::PBufferStream pStream,
                        const CSize_i &pSize);
    virtual void WriteImage(const img::CView_rgb8 &pView,io::PBufferStream pStream);
    virtual void ReadImage(img::CImage_rgba8 &pData,io::PBufferStream pStream,
                        const CSize_i &pSize);
    virtual void WriteImage(const img::CView_rgba8 &pView,io::PBufferStream pStream);

protected:
    XpmImage mXpmImage;
    XpmAttributes mAttributes;
};

class CXPMPlugin : public CImagePlugin
{
public:
    CXPMPlugin()
    {
        RegisterPlugin("xpm",this);
        RegisterPlugin("XPM",this);
    }
    
    CImageCodec *GetInstance()
    {
        return new CXPMCodec;
    }
};

static CXPMPlugin sXPMPlugin;

CXPMCodec::CXPMCodec()
{
}

CXPMCodec::~CXPMCodec()
{
}

void CXPMCodec::ReadImage(img::CImage_rgb8 &pData,io::PBufferStream pStream,const CSize_i&)
{
    char lBuffer[100000];
    pStream->Read(lBuffer,100000);

    int lStatus=XpmCreateXpmImageFromBuffer(lBuffer,&mXpmImage,nullptr);
    if(lStatus!=XpmSuccess)
        throw XInternal(I18N("can't load xpm image"));

    XImage *lImage;
    XImage *lShapeImage;
    
    mAttributes.valuemask=0;

    lStatus=XpmCreateImageFromXpmImage(get_default_x11_display()->GetDisplay(),
            &mXpmImage,&lImage,&lShapeImage,&mAttributes);
    if(lStatus!=XpmSuccess)
        throw XInternal(I18N("can't get image from xpmimage"));

    pData.Recreate(CSize_i(mXpmImage.width,mXpmImage.height));
}

void CXPMCodec::ReadImage(img::CImage_rgba8 &pData,io::PBufferStream pStream,
                                const CSize_i &pSize)
{
    img::CImage_rgb8 lImage;
    
    ReadImage(lImage,pStream,pSize);
    
    pData.Recreate(lImage.Size());
    
    convert_pixels(lImage,pData);
}

void CXPMCodec::ReadImage(img::CImage_gray8 &pData,io::PBufferStream pStream,
                                const CSize_i &pSize)
{
    img::CImage_rgb8 lImage;
    
    ReadImage(lImage,pStream,pSize);
    
    pData.Recreate(lImage.Size());
    
    convert_pixels(lImage,pData);
}

void CXPMCodec::WriteImage(const img::CView_gray8&,io::PBufferStream)
{
}

void CXPMCodec::WriteImage(const img::CView_rgb8&,io::PBufferStream)
{
}

void CXPMCodec::WriteImage(const img::CView_rgba8&,io::PBufferStream)
{
}

/*namespace x11*/ } /*namespace gui*/ } /*namespace buola*/ }
#endif